package com.andrewli.designpattern;

public class Singleton {

    private static class InstanceHolder {
        private final static Singleton sInstance = new Singleton();
    }

    public static Singleton getInstance() {
        return InstanceHolder.sInstance;
    }

    public void sayHello() {
        System.out.print("Hello, world!\n");
    }

    private Singleton() {
    }

    public static void main(String[] args) {
        Singleton.getInstance().sayHello();
    }
}
